#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
	int n,a[1000];
	int i,max,min;
	double final_score,total=0;
	int max1(int a,int b[]);
	int min1(int a,int b[]);
	cin>>n;
	if (n<=1000)
	{
		for (i=0;i<n;i++)
		{
			cin>>a[i];
			total = total + a[i];
		}
		max = max1(n,a);
		min = min1(n,a);
		total = total - max - min;
		final_score = total / (n-2);
		cout<<setprecision(2)<<setiosflags(ios::fixed)<<final_score<<endl;
	}
	else cout<<"Error!"<<endl;
	return 0;
}

int max1(int a,int b[])
{
	int i,t;
	t = b[0];
	for (i=0;i<a;i++)
	{
		if (b[i]>t) t = b[i];
		else continue;
	}
	return t;
}

int min1(int a,int b[])
{
	int i,t;
	t = b[0];
	for (i=0;i<a;i++)
	{
		if (b[i]<t) t = b[i];
		else continue;
	}
	return t;
}
